﻿@model IEnumerable<Authoring.WebRole.Models.Reference>

@{
    ViewBag.Title = "Index";
}

<h2>Reference - Index</h2>

<p>
    @if (ViewBag.write)
    {
        @Html.ActionLink("Create New", "Create")
    }
</p>
<table>
    <tr>
        <th>
            Authors
        </th>
        <th>
            BookChapters
        </th>
        <th>
            Title
        </th>
        <th>
            CitationType
        </th>
        <th>
            PageNumbers
        </th>
        <th>
            Publication
        </th>
        <th>
            PublicationDates
        </th>
        <th>
            Source
        </th>
        <th>
            IsVisible
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Authors)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.BookChapters)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Title)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CitationType.CitationType1)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.PageNumbers)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Publication)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.PublicationDates)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Source)
        </td>
         <td>
            @Html.DisplayFor(modelItem => item.IsVisible)
        </td>
       <td>
        @if(ViewBag.delete) 
        {
            @Html.ActionLink("Edit", "Edit", new { id=item.ID })  
            @String.Format("{0}", "|");
            @Html.ActionLink("Details", "Details", new { id=item.ID }) 
            @String.Format("{0}", "|");
            @Html.ActionLink("Delete", "Delete", new { id = item.ID })
        }
        else if (ViewBag.write)
        {
            @Html.ActionLink("Edit", "Edit", new { id = item.ID }) 
            @String.Format("{0}", "|");
            @Html.ActionLink("Details", "Details", new { id = item.ID })
        }
        else if (ViewBag.read)
        { 
            @Html.ActionLink("Details", "Details", new { id = item.ID })
        }            
        </td>
    </tr>
}

</table>
